<template>
  <div class="sms">
    <!-- <el-card class="box-card-list" v-for="item in card" :key="item.id"> -->
        <el-button size="small" style="width: 100px;" @click="back">返回</el-button>
        <div class="list">
            <div class="li">
                <div class="info" v-for="item in data" :key="item.phone">
                    <div style="display: flex;">
                        <div class="li-label">数据:</div>
                        <div class="li-txt" style="margin-left: 10px">{{item.data}}</div>
                    </div>
                    <el-button size="small" type="info" style="width: 100px;" v-clipboard:copy="getCopyStr(item.data)" v-clipboard:success="onCopy" v-clipboard:error="onError">复制短信内容</el-button>
                </div>
                <div class="info">
                    <div style="display: flex;">
                        <div class="li-label">数据:</div>
                        <div class="li-txt" style="margin-left: 10px">付珍 15073464276</div>
                    </div>
                    <el-button size="small" type="info" style="width: 100px;" @click="gosms(1)">复制短信内容</el-button>
                </div>
            </div>
        </div>
    
  </div>
</template>

<script>
import comm from "@/mixins/comm.js";
export default {
    mixins: [comm],
    data() {
        return {
            data: [
                {
                    data: "FUZ 15073464276",
                }
                
            ],
            text: "钱下了，支付宝看下"
        }
    },
    async created() {
        // this.phone = localStorage.getItem("qqSmsPhone") || ''
        // this.timer = setInterval(()=>{
        //     this.init()
        // },3000)
        // this.init()
    },
    methods: {
        back(){
            this.$router.push({
                name:"details",
            })
        },
        getCopyStr(str) {
            return str.replace(/[\d\s]+/g, '')+this.text;
        },
        onCopy(e) {
            console.log(e)
            // let str = e.text.replace(/\d+/g, '');
              alert('复制成功！');
        },
    onError() {
      alert('复制失败，请重试！');
    },
        async init() {
            // let res = await this.$awaitApi("getsmsList",{phone:this.phone})
            // if(res.data) {
            //     this.card = res.data.data
            // } else {
            //     alert("服务器繁忙，请刷新后再试，联系客服suren24566")
        // }
        },
        async postSms() {
            // localStorage.setItem("qqSmsPhone", this.phone)
            // this.loading = true
            // let res = await this.$awaitApi("postSms", {phones: this.phone})
            // console.log(res)
            // if(res.data.data.code == 500) {
            //     alert(res.data.data.msg)
            // }
            // // await this.$awaitApi("awaitTime")
            // this.loading = false
        }
    },
    beforeDestroy() {
        // if(this.timer) {
        //     clearInterval(this.timer)
        // }
    }
}
</script>

<style lang="less" scoped>
.sms {
    width: 94%;
    margin: 10px auto;
    .el-button {
        width: 100%;
        margin-top: 15px;
    }
    .box-card-list {
        margin-top: 10px;
        font-size: 12px;
        img {
            width: 150px;
        }
        .info {
            display: flex;align-items: center;
        }
    }
}
</style>
